#ifndef __BMI088_H
#define __BMI088_H

#define ACC_CHIP_ID 0X1E

#define ACC_PWR_CTRL 0X7D
#define ACC_OFF 0X00
#define ACC_ON 0X04

#define ACC_PWR_CONF 0X7C
#define ACC_ACTIVE 0X00
#define ACC_SUSPEND 0X03

/* 加速度量程范围设定 */
#define ACC_RANG 0X41
#define Plus_Minus_3G 0X00
#define Plus_Minus_6G 0X01
#define Plus_Minus_12G 0X02
#define Plus_Minus_24G 0X03

/* 加速度信号输出频率设定 */
#define BMI088_ACC_ODR_SHFITS 0x0
#define BMI088_ACC_12_5_HZ (0x5 << BMI088_ACC_ODR_SHFITS)
#define BMI088_ACC_25_HZ (0x6 << BMI088_ACC_ODR_SHFITS)
#define BMI088_ACC_50_HZ (0x7 << BMI088_ACC_ODR_SHFITS)
#define BMI088_ACC_100_HZ (0x8 << BMI088_ACC_ODR_SHFITS)
#define BMI088_ACC_200_HZ (0x9 << BMI088_ACC_ODR_SHFITS)
#define BMI088_ACC_400_HZ (0xA << BMI088_ACC_ODR_SHFITS)
#define BMI088_ACC_800_HZ (0xB << BMI088_ACC_ODR_SHFITS)
#define BMI088_ACC_1600_HZ (0xC << BMI088_ACC_ODR_SHFITS)

#define GYRO_CHIP_ID 0X0F

#define GYRO_RANG 0X0F
#define Plus_Minus_2000 0X00
#define Plus_Minus_1000 0X01
#define Plus_Minus_500 0X02
#define Plus_Minus_250 0X03
#define Plus_Minus_125 0X04

#define GYRO_BANDWIDTH 0X10
/* 2000代表采样频率，532代表数据宽度 */
#define ODR_2000_FD_532 0X00
#define ODR_2000_FD_230 0X01
#define ODR_1000_FD_116 0X02
#define ODR_400_FD_47 0X03
#define ODR_200_FD_23 0X04
#define ODR_100_FD_12 0X05
#define ODR_200_FD_64 0X06
#define ODR_100_FD_32 0X07

#define MPU_ACCE_M_S_2 (6.0 / 32768.0)  // 单位换算，将LSB化为m/(s^2)         6g换算
#define MPU_GYRO_TO_DPS (500 / 32768.0) // 单位换算，将LSB化为 gegree/s       +-500 °/s

uint8_t BMI088_Init(void);
void BMI088_ConverData(void);
void BMI088_GetGYROzError(void);

#endif
